/*
 * State.hpp
 *
 *  Created on: 04-01-2011
 *      Author: Piotr
 */

#pragma once

#include "utils/RangedValue.hpp"
#include "geometry/Vector.hpp"
#include "biology/Genotype.hpp"

/*
 * Current state of a single individual.
 */
class State
{
	public:
		static const float HUNGER_MAX_VALUE;
		static const float THIRST_MAX_VALUE;
		static const float LIBIDO_MAX_VALUE;
		static const float LIFE_MAX_VALUE;

		static const float HUNGRY_BORDER;
		static const float THIRST_BORDER;
		static const float LIBIDO_BORDER;
		static const float DRINKING_SPEED;
		static const float EATING_SPEED;

	private:
		Genotype genotype;

		RangedValue<float> hunger;
		RangedValue<float> thirst;
		RangedValue<float> libido;
		RangedValue<float> life;

		Vector lookDirection;

	public:
		explicit State(const Genotype& genotype);

		const Vector& getLookDirection() const;
		void setLookDirection(const Vector& lookDirection);
		void updateWithDeltaTime(float deltaTimeInSeconds);

		float getHungerValue() const;
		void setHungerValue(float hungerValue);
		void changeHungerValue(float amount);
		bool isHungry() const;

		float getThirstValue() const;
		void setThirstValue(float thirstValue);
		void changeThirstValue(float amount);
		bool isThirsty() const;

		float getLibidoValue() const;
		bool isMatingTime() const;
		void setLibidoValue(float libidoValue);
		void clearLibidoValue();

		float getLifeValue() const;
		void changeLifeValue(float value);
		void setLifeValue(float lifeValue);

		bool isDead() const;

	private:
		bool isStarved() const;
};
